﻿using Device.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Device.Infrstructre
{
    public interface IRepository<T> where T : class,new()
    {
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="item">要添加的实体</param>
        /// <returns>返回受影响行数</returns>
        Task<int> AddAsync(T item);
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="item">要修改的实体</param>
        /// <returns>返回受影响行数</returns>
        Task<int> UpdateAsync(T item);
        /// <summary>
        /// 反填
        /// </summary>
        /// <param name="id">要反填的实体id</param>
        /// <returns>返回满足条件的数据</returns>
        Task<T> GetModelAsync(int id);
        /// <summary>
        /// 列表显示
        /// </summary>
        /// <returns>返回满足条件的数据</returns>
        Task<List<T>> GetAllAsync();    
        /// <summary>
        /// 带查询条件的列表显示
        /// </summary>
        /// <param name="predicate">查询条件</param>
        /// <returns>返回满足条件的数据</returns>
        Task<List<T>> GetAsync(Expression<Func<T, bool>> predicate);
        
    }
}
